#pragma once
#include "featureextractorbase.h"

class CMorphologyFeatExtractor :
	public CFeatureExtractorBase
{
public:
	CMorphologyFeatExtractor(void);
	virtual ~CMorphologyFeatExtractor(void);
	virtual TFeatureVector ExtractFeaturesFromImage( IplImage * img ); 
	virtual TDataSet ExtractFeaturesFromData( CDataPointManager * dpMgr, bool loadImages=true);
	//virtual TDataSet Normalize( TDataSet& data );
	virtual TFeatureVectorLabel GetLabels( void );
	void Reset(void);
	virtual void SetThreshold( int threshold ){ m_threshold = threshold; };
protected:
	
	IplImage * ImgToBW(IplImage* img); 
	CvSeq* ExtractContourStats(IplImage * img);
	IplImage * GetEdgeImage(IplImage * img); 
	void ExtractLineHistogram(IplImage * img);
	CvRect m_sz;
	int m_threshold;
	int m_orientationBins;
	int m_lengthBins;
	int m_sampleArea;
	int m_samplePerimeter; 
	double m_contourLength;
	double m_contourArea;
	double m_aspectRatio;
	CvMemStorage* m_memStorage;
	CvSeq* m_contour;
	CvHuMoments m_huMoments;
	CvHistogram * m_LineHist;
	CvHistogram * m_CircleHist; 
};
